import { createApp } from 'vue'
import { createRouter, createWebHistory } from 'vue-router'
import { createPinia } from 'pinia'
import App from './App.vue'
import routes from './router'
import './assets/style.css'

declare global { interface Window { __INITIAL_ROUTE__?: string } }

const router = createRouter({ history: createWebHistory(), routes })
const pinia = createPinia()

const app = createApp(App).use(router).use(pinia)

if (window.__INITIAL_ROUTE__) {
  router.isReady().then(() => router.replace(window.__INITIAL_ROUTE__!))
}

app.mount('#app')
